import app
# 定义一个接口类
class TenderApi(object):
    # 初始化方法
    def __init__(self):
        self.get_loaninfo_url = app.BASE_URL + "/common/loan/loaninfo"
        self.get_turst_tender_url = app.BASE_URL + "/trust/trust/tender"
# 获取投资详情
    def get_loaninfo(self,session,loan_id):
        url = self.get_loaninfo_url
        data = {"id":loan_id}
        response = session.post(url,data=data)
        return response
    # 定义投资方法
    def tender_trust(self,session,tender_id,amount):
        trust_data = {"id":tender_id,
                        "depositCertificate":-1,
                        "amount":amount}
        response = session.post(self.get_turst_tender_url,data=trust_data)
        return response
    # 获取我的投资列表
    def get_my_tender_list(self,session,status):
        url = app.BASE_URL + "/loan/tender/mytenderlist"
        list_data = {"page":1,
"status":status}
        response = session.post(url,data=list_data)
        return response
